<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // JSON格式转化为其它数据类型格式
    let xh={
        title:'小灰',
        url:'www.baidu.com',
        teacher:{
            name:'好好学习'
        }
    };
    let json =JSON.stringify(xh,null,2);
    console.log(typeof json);//string
    
    let obj_one=JSON.parse(json);
    console.log(obj_one);

    let obj_two=JSON.parse(json,(key,value)=>{
        if(key="title"){
            value="[好好学习]-"+value;
        }
        return value;
    });
    console.log(obj_two);
    
    
</script>
</html>